package nodes;

import compiler.Compiler;
import compiler.SymbolTable;

import descriptors.AbstractDescr;

public class ConstNode extends AbstractNode {

	IdentNode ident;
	ExpressionNode expression;
	
	public ConstNode(IdentNode ident, ExpressionNode expression,int line,int column){
		super(line,column);
		this.ident=ident;
		this.expression=expression;
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public AbstractDescr compile(
			SymbolTable symbolTable, Compiler compiler) {
		AbstractDescr constDescr=expression.compile(symbolTable, compiler);
		symbolTable.set(ident.ident(),constDescr);
		return null;
	}

	@Override
	public void print() {
		trace("ConstNode");
		ident.print();
		expression.print();
		unindent();

	}

}
